package models

import "time"

var (
	UserSubscribeStatus map[int]string
	UserStatus          map[int]string
	UserIdentity        map[int]string
)

// 会员
type User struct {
	Id                  int64            `orm:"description(自增主键)"`
	InviteUser          *User            `orm:"rel(fk);null;default(0);description(邀请会员id)" json:"-"`
	StudentRelation     *StudentRelation `orm:"rel(fk);null;default(0);description(关系id)" json:"-"`
	FamilySn            string           `orm:"description(家庭编号，来源于学生的FamilySn)" json:"-"`
	Students            []*Student       `orm:"rel(m2m);rel_through(anban/models.UserStudent)" json:"-"`
	Classes             []*Class         `orm:"rel(m2m);rel_through(anban/models.UserClass)" json:"-"`
	OpenId              string           `orm:"description(微信公众平台openid)" json:"-"`
	MiniOpenId          string           `orm:"description(微信小程序openid)" json:"-"`
	UnionId             string           `orm:"description(微信开放平台unionid)" json:"-"`
	RealName            string           `orm:"description(姓名)"`
	Phone               string           `orm:"description(电话)"`
	PhoneShow           string           `orm:"-"`
	IdCard              string           `orm:"description(身份证号)" json:"-"`
	ShortName           string           `orm:"description(简称，如李老师)"`
	NickName            string           `orm:"description(微信昵称)"`
	HeadImgUrl          string           `orm:"description(微信头像)" json:"-"`
	WithdrawMoney       float64          `orm:"digits(12);decimals(2);description(可提现余额)"`
	IsMain              int              `orm:"description(是否是主家长或班主任，0否 1是)"`
	IsContract          int              `orm:"description(是否签约微信支付代扣，0未签约 1已签约)" json:"-"`
	ContractId          string           `orm:"description(支付代扣签约协议id)" json:"-"`
	ContractExpireTime  time.Time        `orm:"type(datetime);null;description(签约协议到期时间)" json:"-"`
	Status              int              `orm:"description(状态，0禁用 1正常)"`
	StatusShow          string           `orm:"-" json:"-"`
	Identity            int              `orm:"description(身份 0未知 1家长 2老师 3家长&老师 4校领导)"`
	IdentityShow        string           `orm:"-" json:"-"`
	SubscribeStatus     int              `orm:"description(关注公众号状态 0未关注 1已关注 2已取消关注)"`
	SubscribeStatusShow string           `orm:"-" json:"-"`
	SubscribeTime       time.Time        `orm:"type(datetime);null;description(关注公众号时间)" json:"-"`
	SubscribeTimeShow   string           `orm:"-" json:"-"`
	UnsubscribeTime     time.Time        `orm:"type(datetime);null;description(取消关注公众号时间)" json:"-"`
	UnsubscribeTimeShow string           `orm:"-" json:"-"`
	Created             time.Time        `orm:"auto_now_add;type(datetime);description(创建时间)" json:"-"`
	CreatedShow         string           `orm:"-" json:"-"`
	Updated             time.Time        `orm:"auto_now;type(datetime);description(最后一次更新时间)" json:"-"`
	UpdatedShow         string           `orm:"-" json:"-"`
	CourseName          string           `orm:"-"`
	RelationName        string           `orm:"-"`
	FamilyMemberNum     int64            `orm:"-"`
	ChildrenMemberNum   int64            `orm:"-"`
}

func init() {

	UserSubscribeStatus = map[int]string{
		0: "未关注",
		1: "已关注",
		2: "已取消关注",
	}

	UserStatus = map[int]string{
		0: "禁用",
		1: "正常",
	}

	UserIdentity = map[int]string{
		0: "未知",
		1: "家长",
		2: "老师",
		3: "家长&老师",
		4: "校领导",
	}

}
